$(function () {
  layui.use(['form', 'layer'], () => {
    let form = layui.form,
      layer = layui.layer;
    form.on('submit(login)', data => {
      let field = data.field;
      $.post('/emp/login', field, result => {
        if (result > 0) {
          layer.msg('登录成功，跳转中······');
          setTimeout(() => {
            window.location.href = '/provider';
          }, 1000);
        } else {
          layer.msg('用户名或密码错误!');
        }
      });
    })
  })
});